package com.linewow.xhyy.nihaonew.net.api;

import com.linewow.xhyy.nihaonew.base.SimpleBaseEntity;
import com.linewow.xhyy.nihaonew.model.HttpModel;
import com.linewow.xhyy.nihaonew.net.CallBack.JsonConvert;
import com.lzy.okgo.OkGo;
import com.lzy.okrx.RxAdapter;

import rx.Observable;

/**
 * Created by LXR on 2016/10/29.
 */
public class NiHaoOkgo2 {

    public static Observable<SimpleBaseEntity<String>> registerInfo(String email, String nickname, String pwd1, String pwd2){
        return  OkGo.post(HttpModel.USERREGISTER)
                .params("email",email)
                .params("nickname",nickname)
                .params("password",pwd1)
                .params("password1",pwd2)
                .getCall(new JsonConvert<SimpleBaseEntity<String>>(){}, RxAdapter.<SimpleBaseEntity<String>>create());
    }

    public  static Observable<SimpleBaseEntity<String>>loginInfo(String email,String pwd){
        return OkGo.post(HttpModel.USERLOGIN)
                .params("email",email)
                .params("password",pwd)
                .getCall(new JsonConvert<SimpleBaseEntity<String>>(){},RxAdapter.<SimpleBaseEntity<String>>create());

    }
}
